package com.zhl.operator;

public class OperatorDemo3 {
    public static void main(String[] args) {
        //目标：掌握扩展运算符的使用
        // 隐含强制类型转换
        // +=
        double a = 10.5;
        double b = 520;
        a += b; // a = a + b
        System.out.println("a = " + a); // 625.5

        // -=
        double i= 1600;
        double j = 500;
        i -= j; // i = i - j
        System.out.println("i = " + i); // 1100

        // *=
        int k = 2;
        int l = 4;
        k *= l; // k = k * l
        System.out.println("k = " + k); // 8

        // /=
        int m = 100;
        int n = 2;
        m /= n; // m = m / n
        System.out.println("m = " + m); // 50

        // %=
        int p = 10;
        int q = 4;
        p %= q; // p = p % q
        System.out.println("p = " + p); // 2


        System.out.println("-----------------------");
        byte x = 10;
        byte y = 30;
        x+=y;   //等价于  x = (byte)(x + y);
        System.out.println("x = " + x); // 40
    }
}
